package cn.cyb.server.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.TimeZone;

/**
 * @author yuebo
 * @date 2025/2/20
 */
@Configuration
public class WebConfig {

    @Bean
    public ObjectMapper objectMapper() {
        // @JsonFormat 时区错误，时间计算少了8个小时：https://blog.csdn.net/qq_39889242/article/details/145634680
        // 设置全局时区同服务器时区设置
        return new ObjectMapper().setTimeZone(TimeZone.getDefault());
    }
}
